package com.wkq.util.transformer

import android.view.View
import androidx.viewpager2.widget.ViewPager2

/**
 *
 *@Author: wkq
 *
 *@Time: 2025/7/28 18:01
 *
 *@Desc: 页面抖动感滑动（JellyTransformer）
 */
class JellyTransformer : ViewPager2.PageTransformer {

    override fun transformPage(view: View, position: Float) {
        val factor = 0.15f
        view.translationX = -position * view.width * factor
        view.scaleX = 1f - kotlin.math.abs(position) * factor
        view.scaleY = 1f - kotlin.math.abs(position) * factor
    }

}